﻿@model List<Yglab.Models.Gui_Journal>

<table class="table table-condensed table-hover">
    <tbody>
        @foreach (Yglab.Models.Gui_Journal gui_journal in Model)
        {
        <tr>
            @if(@gui_journal.State == 1){
                <td>@Html.RouteLink(gui_journal.Journal.Name, "Journal", new { action = "Articles", controller = "Journal", journalpath = gui_journal.Journal.PathName })  </td>
            }
            else{
                <td> @gui_journal.Journal.Name </td>
            }
            @if(@gui_journal.State == 1){
                
                <td> @gui_journal.Journal.Editor.Name <text> </text> 
                    @gui_journal.Journal.Editor.Surname  <text>(</text> 
                    @gui_journal.Journal.Editor.Email <text>)</text> 
                </td>
                
            }else if (@gui_journal.State == 2){
                if(@gui_journal.Invitation.UserType == 1){
                    <td> @gui_journal.Invitation.InvitedUser.Name <text> </text> 
                        @gui_journal.Invitation.InvitedUser.Surname  <text>(</text> 
                        @gui_journal.Invitation.InvitedUser.Email <text>)</text> 
                    </td>
                    @*<td> Davet edildi: @gui_journal.Invitation.InvitedUser.Email </td>*@
                }
                else if (@gui_journal.Invitation.UserType == 2){
                    <td> Davet edildi: @gui_journal.Invitation.InvitedUserEmail </td>
                }
            }else {
                <td>  
                    @using (Html.BeginForm("InviteEditor", "Admin", FormMethod.Post, new { @class = "form-inline"}) ){
    
                        @Html.Hidden("journalId", gui_journal.Journal.Id)

                        @Html.TextBox("invitedEmail", "", new { @placeholder = "Email giriniz.." })

                        <button type="submit" class="btn">Davet et</button>
                    }
                </td>
            }
        </tr>
        }
    </tbody>
</table>

@using (Html.BeginForm("AddJournal", "Admin", FormMethod.Post, new { @class = "form-inline"}) ){
    
    @Html.TextBox("Name", "", new { @placeholder = "Derginin ismi.." })

    @Html.TextBox("PathName", "", new { @placeholder = "Derginin alt alanını giriniz.." })
        
    <button type="submit" class="btn">Ekle</button>
}
